/**
 */
package org.xtext.example.mydsl.myDsl.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import org.xtext.example.mydsl.myDsl.Building;
import org.xtext.example.mydsl.myDsl.MyDslPackage;
import org.xtext.example.mydsl.myDsl.Parametric;
import org.xtext.example.mydsl.myDsl.Scene;
import org.xtext.example.mydsl.myDsl.Surface;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Scene</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.SceneImpl#getParametrics <em>Parametrics</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.SceneImpl#getBuildings <em>Buildings</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.SceneImpl#getSurfaces <em>Surfaces</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class SceneImpl extends TypeImpl implements Scene
{
  /**
   * The cached value of the '{@link #getParametrics() <em>Parametrics</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getParametrics()
   * @generated
   * @ordered
   */
  protected EList<Parametric> parametrics;

  /**
   * The cached value of the '{@link #getBuildings() <em>Buildings</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getBuildings()
   * @generated
   * @ordered
   */
  protected EList<Building> buildings;

  /**
   * The cached value of the '{@link #getSurfaces() <em>Surfaces</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSurfaces()
   * @generated
   * @ordered
   */
  protected EList<Surface> surfaces;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected SceneImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return MyDslPackage.Literals.SCENE;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Parametric> getParametrics()
  {
    if (parametrics == null)
    {
      parametrics = new EObjectContainmentEList<Parametric>(Parametric.class, this, MyDslPackage.SCENE__PARAMETRICS);
    }
    return parametrics;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Building> getBuildings()
  {
    if (buildings == null)
    {
      buildings = new EObjectContainmentEList<Building>(Building.class, this, MyDslPackage.SCENE__BUILDINGS);
    }
    return buildings;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Surface> getSurfaces()
  {
    if (surfaces == null)
    {
      surfaces = new EObjectContainmentEList<Surface>(Surface.class, this, MyDslPackage.SCENE__SURFACES);
    }
    return surfaces;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case MyDslPackage.SCENE__PARAMETRICS:
        return ((InternalEList<?>)getParametrics()).basicRemove(otherEnd, msgs);
      case MyDslPackage.SCENE__BUILDINGS:
        return ((InternalEList<?>)getBuildings()).basicRemove(otherEnd, msgs);
      case MyDslPackage.SCENE__SURFACES:
        return ((InternalEList<?>)getSurfaces()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case MyDslPackage.SCENE__PARAMETRICS:
        return getParametrics();
      case MyDslPackage.SCENE__BUILDINGS:
        return getBuildings();
      case MyDslPackage.SCENE__SURFACES:
        return getSurfaces();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case MyDslPackage.SCENE__PARAMETRICS:
        getParametrics().clear();
        getParametrics().addAll((Collection<? extends Parametric>)newValue);
        return;
      case MyDslPackage.SCENE__BUILDINGS:
        getBuildings().clear();
        getBuildings().addAll((Collection<? extends Building>)newValue);
        return;
      case MyDslPackage.SCENE__SURFACES:
        getSurfaces().clear();
        getSurfaces().addAll((Collection<? extends Surface>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.SCENE__PARAMETRICS:
        getParametrics().clear();
        return;
      case MyDslPackage.SCENE__BUILDINGS:
        getBuildings().clear();
        return;
      case MyDslPackage.SCENE__SURFACES:
        getSurfaces().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.SCENE__PARAMETRICS:
        return parametrics != null && !parametrics.isEmpty();
      case MyDslPackage.SCENE__BUILDINGS:
        return buildings != null && !buildings.isEmpty();
      case MyDslPackage.SCENE__SURFACES:
        return surfaces != null && !surfaces.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //SceneImpl
